﻿using System;

namespace ALDIOrganizer
{
    public partial class Cell
    {
        public Int64 EmployeeID
        {
            get
            {
                return Tag.Int64Value;
            }
        }

        public EmployeeInRota GetMyEmployee
        {
            get
            {
                return GetParentAsRota == null ?
                    null :
                    GetParentAsRota.Employees.GetEmployee(EmployeeID);
            }
        }

        public Request[] GetMyRequests
        {
            get
            {
                return GetMyEmployee.RequestStatuses.Value[_column - 1].ToArray();
            }
        }

        public bool HasAnyRequests
        {
            get
            {
                if (GetParentMode == SheetType.Template)
                {
                    return false;
                }
                if (!IsEditable)
                {
                    return false;
                }
                var employee = GetMyEmployee;
                return employee != null && employee.RequestStatuses.Key[_column - 1];
            }
        }

    }
}
